import { Navigate } from "react-router-dom";


const withLogin = (Com) => {
    return  function () {
      const token = localStorage.getItem("token");
      if (token) {
        return <Com></Com>;
      } else {
        return <Navigate to="/login"></Navigate>;
      }
    };
  };
  
  export default withLogin;